{ "cells": [ { "cell_type": "markdown", "id": "f457dcfc", "metadata": {}, "source": [ "# Discussion of the Equilibrium Concept (6)" ] }, { "cell_type": "code", "execution_count": 1, "id": "74cba7b6", "metadata": { "ExecuteTime": { "end_time": "2022-06-09T13:29:20.000728Z", "start_time": "2022-06-09T13:29:18.815746Z" } }, "outputs": [], "source": [ "import numpy as np\n", "from poisson_approval import *" ] }, { "cell_type": "code", "execution_count": 2, "id": "87521eda", "metadata": { "ExecuteTime": { "end_time": "2022-06-09T13:29:20.016653Z", "start_time": "2022-06-09T13:29:20.001721Z" } }, "outputs": [], "source": [ "random_profile = RandProfileHistogramUniform(n_bins=1)" ] }, { "cell_type": "code", "execution_count": 3, "id": "117c6f44", "metadata": { "ExecuteTime": { "end_time": "2022-06-09T13:51:48.478176Z", "start_time": "2022-06-09T13:29:20.017667Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "not_converge=524\n", "converge_ordinal=1168\n", "converge_cardinal_is_large_equilibrium=8308\n", "converge_cardinal_is_not_large_equilibrium=0\n" ] } ], "source": [ "not_converge = 0\n", "converge_ordinal = 0\n", "converge_cardinal_is_large_equilibrium = 0\n", "converge_cardinal_is_not_large_equilibrium = 0\n", "for i in range(10000):\n", " profile = random_profile()\n", " result = profile.fictitious_play(\n", " init='random_tau', \n", " n_max_episodes=1000,\n", " perception_update_ratio=one_over_log_t_plus_one,\n", " ballot_update_ratio=one_over_log_t_plus_one\n", " )\n", " if not result['converges']:\n", " not_converge += 1\n", " elif result['tau'].focus == Focus.DIRECT:\n", " converge_ordinal += 1\n", " else:\n", " is_stable = profile.is_equilibrium_stable(result['strategy'])\n", " if is_stable:\n", " converge_cardinal_is_large_equilibrium += 1\n", " else:\n", " converge_cardinal_is_not_large_equilibrium += 1\n", " break\n", "print(f\"{not_converge=}\")\n", "print(f\"{converge_ordinal=}\")\n", "print(f\"{converge_cardinal_is_large_equilibrium=}\")\n", "print(f\"{converge_cardinal_is_not_large_equilibrium=}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "bf09e2a9", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": false, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 5 }